package com.thrd.taiexhibition.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.widget.TextView;

import com.facebook.drawee.generic.RoundingParams;
import com.thrd.basicframework.bean.BaseRecyclerAdapter;
import com.thrd.basicframework.utils.TimeUtils;
import com.thrd.taiexhibition.R;
import com.thrd.taiexhibition.bean.BeanHotArticle;
import com.thrd.taiexhibition.fresco.FrescoImage;
import com.thrd.taiexhibition.fresco.FrescoUtils;

import java.util.List;

/**
 * @author: ${唐杰}
 * @date: 2021/3/25
 */
public class CityHotSpotLeftAdapter extends BaseRecyclerAdapter<BeanHotArticle> {


    public CityHotSpotLeftAdapter(Context context, List<BeanHotArticle> data) {
        super(context, data);
    }

    @Override
    public void bindData(BaseViewHolder holder, BeanHotArticle beanHotActivty) {

        FrescoImage mFrescoImage = (FrescoImage) holder.getView(R.id.fi_image);
        TextView mTitle = (TextView) holder.getView(R.id.tv_title);
        TextView mTime= (TextView) holder.getView(R.id.tv_time);
        TextView mBrowse= (TextView) holder.getView(R.id.tv_browse);
        RoundingParams roundingParams = RoundingParams.fromCornersRadius(5f);
        FrescoUtils.getInstance().setPrefixProgressLoad(getContext(),mFrescoImage,beanHotActivty.getHotArticleCoverImg(),roundingParams);
        mTitle.setText(TextUtils.isEmpty(beanHotActivty.getHotArticleTitle())?"":beanHotActivty.getHotArticleTitle());
        mTime.setText(TextUtils.isEmpty(beanHotActivty.getCreateTime())?"":beanHotActivty.getHotArticleLabel()+"    "+ TimeUtils.getFormatConversion(beanHotActivty.getCreateTime()));
        mBrowse.setText(beanHotActivty.getAccessNum()+"");
    }

    @Override
    public int getItemLayoutId() {
        return R.layout.item_hot_spot_left;
    }


}
